﻿using JiveMessenger.Models;
using JiveMessenger.User;
using JiveMessenger.ViewModels;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using Windows.UI.Xaml;


namespace JiveMessenger.SampleData
{
    public class SampleViewModelGetUserEmoticons:ViewModelBaseEx
    {

        public ObservableCollection<AddUserEmoticonModel> EmoticonList
        {
            get
            {
               var emoticonList = new ObservableCollection<AddUserEmoticonModel>();
               emoticonList.Add(new AddUserEmoticonModel()
               {
                   EmoticonPath = "ms-appx:///Assets/DefaultEmoticons/angry.png",
                   EmoticonShortcut = ":@",
                   IsValidShortcut = true,
                   Username = "sskodje@hotmail.com",
                   IsChecked = true
               });
               emoticonList.Add(new AddUserEmoticonModel()
               {
                   EmoticonPath = "ms-appx:///Assets/DefaultEmoticons/Smile.png",
                   EmoticonShortcut = ":)",
                   IsValidShortcut = false,
                   ErrorText="already in use",
                   Username = "sskodje@hotmail.com",
                   IsChecked = false
               });

               return emoticonList;
            }
        }

        public IContact SelectedUser
        {
            get 
            {
                            var locator = Application.Current.Resources["Locator"] as ViewModelLocator;
                            return locator.ViewModelContactList.Contacts.FirstOrDefault();
            }

        }

        public SampleViewModelGetUserEmoticons()
        {


            //CreateEmoticonListForUser(this.SelectedUser, locator.CurrentClient);
        }

        //private void CreateEmoticonListForUser(IContact user,IClient client)
        //{
        //    EmoticonList = new ObservableCollection<AddUserEmoticonModel>();


        //    foreach (KeyValuePair<string, IEmoticon> kvp in client.GetEmoticons(user.UserID, false, true, false))
        //    {
        //        string error;
        //        var model = new AddUserEmoticonModel()
        //        {
        //            Username = user.UserName,
        //            EmoticonShortcut = kvp.Key,
        //            EmoticonPath = kvp.Value.EmoticonPath,
        //            IsValidShortcut = client.ValidateEmoticonShortcut(kvp.Key, out error),
        //            ErrorText = error
        //        };

        //        EmoticonList.Add(model);
        //    }

        //}
    }
}
